﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ComputerGraphics.Utils
{
    public static class MathUtils
    {
        private static double doubleMargin = 1e-10;

        public static double GetZeroDouble(double value)
        {
            if (Math.Abs(value) <= doubleMargin)
                return 0;
            else
                return value;
        }

        public static int GetDoubleSign(double value)
        {
            double temp = GetZeroDouble(value);

            if (temp > 0)
                return 1;
            else if (temp < 0)
                return -1;
            else
                return 0;
        }
    }
}
